home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
phagexsources.lha
/
source
/
Mandlebrot.s
< prev
next >
Wrap
Text File
|
1994-07-09
|
8KB
|
505 lines
; Quick MandleBrot code, Old Intuition stuff from the dark ages!
Opt c-
Section "MandleBrotty Code",Code_c
IncDir Df1:
Start Movem.l d0-d7/a0-a6,-(sp)
Bsr KillSys
Lea CopperList(pc),a0
Lea HardWare,a6
Move.l a0,Cop1Lc(a6)
Move.w #$83c0,DMACon(a6)
Lea $c0000,a0
Lea $d0000,a1
Clear Move.l #0,(a0)+
Cmp.l a0,a1
Bne Clear
Bsr DoMandle
Loop Btst #6,$Bfe001
Bne Loop
Bsr ReturnSys
Movem.l (sp)+,d0-d7/a0-a6
Moveq #0,d0
Rts
DoMandle Lea YPos(pc),a6
Move.w #0,(a6)
Move.l Screen(pc),a4
Add.l #$2800,a4
Move.l a4,a1
Add.l #$2800,a4
Move.l a4,a2
Add.l #$2800,a4
Move.l a4,a3
Add.l #$2800,a4
Move.l Screen(pc),a0
Lea YVal(pc),a6
Move.w #0,(a6)
Sub.l a6,a6
DoVert Sub.l a5,a5
Move.l a6,d7
Lea XVal(pc),a6
Move.w #0,(a6)
Move.l d7,a6
DoHoriz Move.l a6,d7
Move.w XVal(pc),d1
Move.w YVal(pc),d0
Move.l d7,a6
Sub.l MandV1(pc),d1
Sub.l MandV2(pc),d0
Move.w MandV3(pc),d7
Move.l d0,d4
Move.l d1,d5
Move.w d0,d2
Muls.w d2,d2
Move.w d1,d3
Muls.w d3,d3
FindColour Sub.l d3,d2
Asr.l #8,d2
Add.w d4,d2
Move.w d1,d3
Muls.w d0,d3
Asr.l #7,d3
Add.w d5,d3
Move.w d2,d0
Move.w d3,d1
Muls.w d2,d2
Muls.w d3,d3
Move.l d2,d6
Add.l d3,d6
Cmpi.l #$40000,d6
Bhi.s GotPixCol
Dbf d7,FindColour
GotPixCol Move.l a5,d2
Move.w d2,d3
Not.w d3
Lsr.w #3,d2
Add.w a6,d2
Add.w d7,d7
Add.w Jumptab+2(pc,d7.w),d7
Jmp Jumptab+2(pc,d7.w)
Jumptab Incbin df0:SysData/MandleJump.Dat
Bra DonePixel
Bset d3,0(a0,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bra DonePixel
Bset d3,0(a2,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a2,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bra DonePixel
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bra DonePixel
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a2,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
Bra DonePixel
Bset d3,0(a0,d2.w)
Bset d3,0(a1,d2.w)
Bset d3,0(a2,d2.w)
Bset d3,0(a3,d2.w)
Bset d3,0(a4,d2.w)
DonePixel Btst #6,$Bfe001
Beq.s QuitMand
Addq.w #1,a5
Move.l a6,d7
Lea XVal(pc),a6
Addi.w #2,(a6)
Move.l d7,a6
Cmpa.w #320,a5
Bne DoHoriz
Move.l a6,d7
Lea YVal(pc),a6
Addi.w #2,(a6)
Move.l d7,a6
Adda.w #40,a6
Move.l a6,-(sp)
Lea YPos(pc),a6
Add.w #1,(a6)
Cmp.w #256,(a6)
Beq QuitM
Move.l (sp)+,a6
Bra DoVert
QuitM Move.l (sp)+,a6
QuitMand Rts
KillSys Bsr.s SysWait
Move.l $4,a6
Lea GFXName(pc),a1
Moveq #0,d0
Jsr -552(a6)
Lea OldCop1(pc),a5
Move.l $26(a0),$0(a5)
Move.l $32(a0),$4(a5)
Lea HardWare,a6
Move.w IntEnaR(a6),d0
Move.w DMAConR(a6),d1
Or.w #$8000,d0
And.w #$03ff,d1
Or.w #$8000,d1
Move.w d0,$8(a5)
Move.w d1,$a(a5)
Move.w #$7fff,IntEna(a6)
Move.w #$7fff,DMACon(a6)
Rts
SysWait Move.w #15,d7
SysWaitLoop Move.l #$05000,d1
Bsr.s WaitVBL
Bsr.s DoWaitVBL
Dbf d7,SysWaitLoop
Rts
DoWaitVBL Move.l #$03000,d1
WaitVBL Movem.l d0-d1/a6,-(sp)
Lea HardWare,a6
WaitVBLLoop Move.l VPosR(a6),d0
And.l #$1ff00,d0
Cmp.l d1,d0
Bne.s WaitVBLLoop
Movem.l (sp)+,d0-d1/a6
Rts
ReturnSys Lea HardWare,a6
Move.w OldIntEna(pc),IntEna(a6)
Move.w OldDMACon(pc),DMACon(a6)
Move.l OldCop1(pc),Cop1lc(a6)
Move.l OldCop2(pc),Cop2lc(a6)
Rts
GFXName Dc.b "graphics.library",0
Even
OldCop1 Dc.l 0
OldCop2 Dc.l 0
OldIntEna Dc.w 0
OldDmaCon Dc.w 0
XVal Dc.w 0
YVal Dc.w 0
YPos Dc.w 0
MandV1 Dc.l 260
MandV2 Dc.l 410
MandV3 Dc.w 30
Screen Dc.l $c0000
Cmv Macro
Dc.w \2,\1
EndM
Cwt Macro
Dc.w (\1*$100)+$01,$fffe
EndM
Pal Macro
Dc.w $ffe1,$fffe
EndM
EndCop Macro
Dc.w $ffff,$fffe
EndM
CopperList Cwt $15
Cmv $0200,BplCon0
Cmv $00bb,BplCon1
Cmv $000a,BplCon2
Cmv $0034,DdfStrt
Cmv $00c8,DdfStop
Cmv $1681,DiwStrt
Cmv $36c1,DiwStop
Cmv $0,BplMod1
Cmv $0,BplMod2
Cwt $16
Cmv $0000,Color00
Cmv $0111,Color01
Cmv $0222,Color02
Cmv $0333,Color03
Cmv $0444,Color04
Cmv $0555,Color05
Cmv $0666,Color06
Cmv $0777,Color07
Cmv $0888,Color08
Cmv $0999,Color09
Cmv $0aaa,Color10
Cmv $0bbb,Color11
Cmv $0ccc,Color12
Cmv $0ddd,Color13
Cmv $0eee,Color14
Cmv $0fff,Color15
Cmv $0fff,Color16
Cmv $0fef,Color17
Cmv $0fdf,Color18
Cmv $0fcf,Color19
Cmv $0fbf,Color20
Cmv $0faf,Color21
Cmv $0f9f,Color22
Cmv $0f8f,Color23
Cmv $0f7f,Color24
Cmv $0f6f,Color25
Cmv $0f5f,Color26
Cmv $0f4f,Color27
Cmv $0f3f,Color28
Cmv $0f2f,Color29
Cmv $0f1f,Color30
Cmv $0f0f,Color31
Cwt $25
CopperBPLS Cmv $0c,BplPt0h
Cmv $0000,BplPt0l
Cmv $0c,BplPt1h
Cmv $2800,BplPt1l
Cmv $0c,BplPt2h
Cmv $5000,BplPt2l
Cmv $0c,BplPt3h
Cmv $7800,BplPt3l
Cmv $0c,BplPt4h
Cmv $a000,BplPt4l
Cwt $28
Cmv $5200,BplCon0
Pal
Cwt $28
Cmv $0200,BplCon0
EndCop
****Custom Chip Registers****
Hardware = $Dff000
;Control Registers
Dmaconr = $002
Vposr = $004
Vhposr = $006
Joy0dat = $00A
Joy1dat = $00C
Clxdat = $00E
Intenar = $01C
Intereqr = $01E
Copcon = $02E
;Blitter Registers
Bltcon0 = $040
Bltcon1 = $042
Bltafwm = $044
Bltalwm = $046
Bltcpth = $048
Bltcptl = $04A
Bltbpth = $04C
Bltbptl = $04E
Bltapth = $050
Bltaptl = $052
Bltdpth = $054
Bltdptl = $056
Bltsize = $058
Bltcmod = $060
Bltbmod = $062
Bltamod = $064
Bltdmod = $066
Bltcdat = $070
Bltbdat = $072
Bltadat = $074
;Copper Registers
Cop1lc = $080
Cop1lch = $080
Cop1lcl = $082
Cop2lc = $084
Cop2lch = $084
Cop2lcl = $086
Copjmp1 = $088
Copjmp2 = $08A
Diwstrt = $08E
Diwstop = $090
Ddfstrt = $092
Ddfstop = $094
Dmacon = $096
Clxcon = $098
Intena = $09A
Intreq = $09C
;BitPlane Registers
BplCon0 = $100
BplCon1 = $102
BplCon2 = $104
BplMod1 = $108
BplMod2 = $10a
BplPt0h = $0e0
BplPt0l = $0e2
BplPt1h = $0e4
BplPt1l = $0e6
BplPt2h = $0e8
BplPt2l = $0ea
BplPt3h = $0ec
BplPt3l = $0ee
BplPt4h = $0f0
BplPt4l = $0f2
BplPt5h = $0f4
BplPt5l = $0f6
;Colour Registers
Color00 = $180
Color01 = $182
Color02 = $184
Color03 = $186
Color04 = $188
Color05 = $18a
Color06 = $18c
Color07 = $18e
Color08 = $190
Color09 = $192
Color10 = $194
Color11 = $196
Color12 = $198
Color13 = $19a
Color14 = $19c
Color15 = $19e
Color16 = $1a0
Color17 = $1a2
Color18 = $1a4
Color19 = $1a6
Color20 = $1a8
Color21 = $1aa
Color22 = $1ac
Color23 = $1ae
Color24 = $1b0
Color25 = $1b2
Color26 = $1b4
Color27 = $1b6
Color28 = $1b8
Color29 = $1ba
Color30 = $1bc
Color31 = $1be
EcsNop = $1fe